from PyQt5.QtWidgets import QFileDialog, QMainWindow
import os




class Service():
    mainWindow: QMainWindow
    dir_path:str
    def __init__(self, mainWindow: QMainWindow):
        self.mainWindow = mainWindow
        self.dir_path = os.path.dirname(os.path.realpath(__file__))
        print(self.dir_path)

    def selectTz(self):
        try:
            fileInfo = QFileDialog.getOpenFileName(self.mainWindow, "选择台账", os.path.expanduser('~') + "\\Desktop", "Excel Files (*.xlsx )")
            print(fileInfo)
            return fileInfo[0]
        except Exception as e:
            print(e)

    def selectMb(self):
        try:
            fileInfo = QFileDialog.getOpenFileName(self.mainWindow, "选择模板", os.path.expanduser('~')+ "\\Desktop", "Excel Files (*.xlsx )")
            print(fileInfo)
            return fileInfo[0]
        except Exception as e:
            print(e)
